package com.kmust.dream.wanderingdream.donation.service.impl;

import com.kmust.dream.wanderingdream.comm.utils.PageUtils;
import com.kmust.dream.wanderingdream.comm.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.kmust.dream.wanderingdream.donation.dao.DonationThingsDao;
import com.kmust.dream.wanderingdream.donation.entity.DonationThingsEntity;
import com.kmust.dream.wanderingdream.donation.service.DonationThingsService;


@Service("donationThingsService")
public class DonationThingsServiceImpl extends ServiceImpl<DonationThingsDao, DonationThingsEntity> implements DonationThingsService {
    @Autowired
    DonationThingsDao donationThingsDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<DonationThingsEntity> page = this.page(
                new Query<DonationThingsEntity>().getPage(params),
                new QueryWrapper<DonationThingsEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<DonationThingsEntity> getList() {
        return donationThingsDao.list();
    }

    @Override
    public List<DonationThingsEntity> getListByNickName(String nickname) {

        return donationThingsDao.getListByNickName(nickname);
    }

    @Override
    public List<DonationThingsEntity> getListByUserName(String username) {

        return donationThingsDao.getListByUserName(username);
    }

}